package com.web.app.action;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.web.atmt.bean.AttachmentType;
import com.web.atmt.service.AttachmentService;
import com.web.atmt.service.impl.AttachmentServiceImpl;

@SuppressWarnings("serial")
public class AttachmentAction extends ActionSupport {
	
	@Override
	public String execute() {
		String typeId = "10010";
		String otherId = "10010100";
		AttachmentService service = new AttachmentServiceImpl();
		HttpServletRequest request = ServletActionContext.getRequest();
		
		try {
	        AttachmentType atmtType = service.getAttachmentType(typeId);
	        request.setAttribute("typeId", typeId);
	        request.setAttribute("otherId", otherId);
	        request.setAttribute("atmtType", JSONObject.fromObject(atmtType).toString());
        } catch (Exception e) {
	        e.printStackTrace();
        }
		
		return SUCCESS;
	}

}
